package com.foodost.idiomer;

import net.tsz.afinal.FinalDb;
import net.tsz.afinal.FinalDb.DbUpdateListener;
import android.app.Application;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

public class IdiomApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        SharedPreferences sf = getSharedPreferences(Constants.DB_SHARED, 0);
        boolean isInitData = sf.getBoolean(Constants.IS_INITDATA, false);
        boolean isInitedExplan = sf.getBoolean(Constants.IS_INITEDEXPLAN, false);
        if(!isInitData){
            initData();
        }
        if(isInitData && !isInitedExplan){
            Intent in = new Intent();
            in.setAction(Constants.INIT_SERVICE_ACTION);
            in.putExtra(Constants.EXPLAN_INITED_FAILED, false);
            startService(in);
        }
    }
    
    public void initData(){
        Intent in = new Intent();
        in.setAction(Constants.INIT_SERVICE_ACTION);
        startService(in);
    }
    
}
